home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best Tools for JAVA
/
Best Tools for JAVA.iso
/
JAVA_ALL
/
IDE
/
SUBARTIC
/
RELEASE.ZIP
/
sub_arctic
/
constraints
/
std_function.java
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Java Source
|
1996-10-04
|
53.6 KB
|
1,505 lines
package sub_arctic.constraints;
import sub_arctic.lib.interactor;
import sub_arctic.lib.interactor_consts;
import sub_arctic.lib.manager;
import sub_arctic.lib.sub_arctic_error;
/**
* This class provides methods for building standard lightweight constraints.
* These methods are all static so various standard constraints can be created
* using a notation such as std_function.offset(PARENT.X(), 5).
*/
public class std_function implements std_constraint_consts, std_encoding_consts {
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Helper function to ensure we get a number in range for 16 bit const.
* @param int num the constant in question.
*/
protected static void check_16_bit(int num)
{
if (num < -0x8000 || num > 0x7fff)
throw new sub_arctic_error("16 bit signed constant expected, "
+ num +" given");
}
//had:
//* @exception bad_constraint if test fails
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Helper function to ensure we get a number in range for 15 bit const.
* @param int num the constant in question.
*/
protected static void check_15_bit(int num)
{
if (num < -0x4000 || num > 0x3fff)
throw new sub_arctic_error("15 bit signed constant expected, "
+ num +"(" + Integer.toString(num,16) + " given");
}
//had:
//* @exception bad_constraint if test fails
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Helper function to ensure we get a number in range for 8 bit const.
* @param int num the constant in question.
*/
protected static void check_8_bit(int num)
{
if (num < 0 || num > 0xff)
throw new sub_arctic_error("8 bit unsigned constant expected, "
+ num +" given");
}
//had:
//* @exception bad_constraint if test fails
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/** A dummy std_objpart_encoding to use internally in building function
* encodings for external constraints.
*/
protected static std_objpart_encoding _dummy = PARENT.X();
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create a constant constraint.
* @param int K the constant value must be a value that will fit in 16 bits.
*/
public static std_constraint konst(int K)
{
check_16_bit(K);
return op0_impl.create(OP_konst,(short)K);
}
//had:
//* @exception bad_constraint if the constant value is out of range.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create a placeholder constraint that indicates an external constraint
* has been applied. This should not normally be used alone since an
* actual external constraint needs to be attached with it. Instead
* use the external constraint API provide by base_interactor, or use
* an std_ext_constraint object.
*/
public static std_constraint external()
{
return op0_impl.create(OP_external,(short)0);
}
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: clip(A, B+K, C-K) which means:
* <pre>
* result = A;
* if (A < B+K) result = B+K;
* if (A < C-K) result = C-K;
* return result
* </pre>
* In this case K is treated as an unsigned 8 bit quantity.<p>
*
* @param std_objpart_encoding A obj/part designator for value to be clipped
* @param std_objpart_encoding B object/part designator for first bound
* @param std_objpart_encoding C object/part designator for second bound
* @param int K 8 bit unsigned constant for "border offset"
* @return std_constraint constraint object for the result
*/
public static std_constraint clip(
std_objpart_encoding A,
std_objpart_encoding B,
std_objpart_encoding C,
int K)
{
check_8_bit(K);
return op3_impl.create(OP_clip, A, B, C, (byte)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: clip(A, B+K, C-K) which means:
* <pre>
* result = A;
* if (A < B+K) result = B+K;
* if (A < C-K) result = C-K;
* return result
* </pre>
* For the external case, K can be any integer.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A obj/part designator for value to be clipped
* @param ext_objpart_encoding B object/part designator for first bound
* @param ext_objpart_encoding C object/part designator for second bound
* @param int K signed constant for "border offset"
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint clip(
ext_objpart_encoding A,
ext_objpart_encoding B,
ext_objpart_encoding C,
int K)
{
int enc = op3_impl.encode(OP_clip, _dummy, _dummy, _dummy, (byte)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, C, K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: wrap(A, B+K, C-K) which means:
* xx later...
*
* @param std_objpart_encoding A obj/part designator for value to be wrapped
* @param std_objpart_encoding B object/part designator for first bound
* @param std_objpart_encoding C object/part designator for second bound
* @param int K 8 bit unsigned constant for "border offset"
* @return std_constraint constraint object for the result
*/
public static std_constraint wrap(
std_objpart_encoding A,
std_objpart_encoding B,
std_objpart_encoding C,
int K)
{
check_8_bit(K);
return op3_impl.create(OP_wrap, A, B, C, (byte)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: wrap(A, B+K, C-K) which means:
* xx later...
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A obj/part designator for value to be wrapped
* @param ext_objpart_encoding B object/part designator for first bound
* @param ext_objpart_encoding C object/part designator for second bound
* @param int K signed constant for "border offset"
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint wrap(
ext_objpart_encoding A,
ext_objpart_encoding B,
ext_objpart_encoding C,
int K)
{
int enc = op3_impl.encode(OP_wrap, _dummy, _dummy, _dummy, (byte)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, C, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: self.fun1(A,K) which is a special function
* in all interactors that can be overridden to to subclass specific things.
* <p>
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint self_fun1(std_objpart_encoding A, int K)
{
check_16_bit(K);
return op1_impl.create(OP_self_fun1, A, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: self.fun1(A,K) which is a
* special function in all interactors that can be overridden to to subclass
* specific things. <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint self_fun1(ext_objpart_encoding A, int K)
{
int enc = op1_impl.encode(OP_self_fun1, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: parent.fun1(A,K) which is a special
* function in all interactors that can be overridden to to subclass specific
* things.<p>
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint parent_fun1(std_objpart_encoding A, int K)
{
check_16_bit(K);
return op1_impl.create(OP_parent_fun1, A, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: parent.fun1(A,K) which is a
* special function in all interactors that can be overridden to to subclass
* specific things.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint parent_fun1(ext_objpart_encoding A, int K)
{
int enc = op1_impl.encode(OP_parent_fun1, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: ~A & (K | 0xffff0000). Note: K is
* silently truncated to 16 bits.<p>
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint not_mask(std_objpart_encoding A, int K)
{
K = K & 0xffff;
return op1_impl.create(OP_not_mask, A, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: ~A & (K | 0xffff0000). Note: K is
* silently truncated to 16 bits.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint not_mask(ext_objpart_encoding A, int K)
{
K = K & 0xffff;
int enc = op1_impl.encode(OP_not_mask, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A & (K | 0xffff0000). Note: K is
* silently truncated to 16 bits.<p>
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint mask(std_objpart_encoding A, int K)
{
K = K & 0xffff;
return op1_impl.create(OP_mask, A, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A & (K | 0xffff0000). Note: K is
* silently truncated to 16 bits.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint mask(ext_objpart_encoding A, int K)
{
K = K & 0xffff;
int enc = op1_impl.encode(OP_mask, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (A - self.wh)/2 + K which is typically
* used for centering. Width or height is chosen based on context to have
* the same orientation as the part being constrained. <p>
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint centered(std_objpart_encoding A, int K)
{
check_16_bit(K);
return op1_impl.create(OP_centered, A, (short)K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: (A - self.wh)/2 + K which is
* typically used for centering. Width or height is chosen based on the
* orientation of the constraint. <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint centered(ext_objpart_encoding A, int K)
{
int enc = op1_impl.encode(OP_centered, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A + K <p>
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint offset(std_objpart_encoding A, int K)
{
check_16_bit(K);
return op1_impl.create(OP_offset, A, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A + K <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint offset(ext_objpart_encoding A, int K)
{
int enc = op1_impl.encode(OP_offset, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create an equality constraint. This is really just an offset()
* operation with an offset constant of 0.
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint eq(std_objpart_encoding A)
{
return op1_impl.create(OP_offset, A, (short)0);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create an external equality constraint. This is really just an offset()
* operation with an offset constant of 0.
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint eq(ext_objpart_encoding A)
{
int enc = op1_impl.encode(OP_offset, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, 0);
}
//had
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A - self.wh - K which is typically
* used do right or bottom justification. Width or height is chosen based
* on context to have the same orientation as the part being constrained. <p>
*
* @param std_objpart_encoding A object/part designator for parameter
* @param int K 16 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint far_edge_just(std_objpart_encoding A, int K)
{
check_16_bit(K);
return op1_impl.create(OP_far_edge_just, A, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A - self.wh - K which is typically
* used do right or bottom justification. Width or height is chosen based
* on the orientation of the constraint. <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint far_edge_just(ext_objpart_encoding A, int K)
{
int enc = op1_impl.encode(OP_far_edge_just, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A + B + K <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint add(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
check_15_bit(K);
return op2_impl.create(OP_add, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A + B + K <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint add(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
int enc = op2_impl.encode(OP_add, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A - B + K <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint subtract(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_subtract, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A - B + K <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K signed value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint subtract(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_subtract, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A * B + K <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint mult(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_mult, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A * B + K <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint mult(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_mult, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (A / B) + K (returns K on div by zero) <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint div(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
check_15_bit(K);
return op2_impl.create(OP_div, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: (A / B) + K (returns K on div
* by zero) <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint div(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
int enc = op2_impl.encode(OP_div, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (A % B) + K (returns K on mod by zero) <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint mod(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
check_15_bit(K);
return op2_impl.create(OP_mod, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: (A % B) + K (returns K on mod
* by zero) <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint mod(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
int enc = op2_impl.encode(OP_mod, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: A & B & K. Note: K is silently truncated
* to 15 bits.<p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint and(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
K = K & 0x7fff;
return op2_impl.create(OP_and, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: A & B & K. Note: K is silently
* truncated to 15 bits.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint and(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
K = K & 0x7fff;
int enc = op2_impl.encode(OP_and, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (A | B) & K. Note: K is silently truncated
* to 15 bits.<p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint or(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
K = K & 0x7fff;
return op2_impl.create(OP_or, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: (A | B) & K. Note: K is silently
* truncated to 15 bits.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint or(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
K = K & 0x7fff;
int enc = op2_impl.encode(OP_or, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (A ^ B) & K. Note: K is silently truncated
* to 15 bits.<p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint xor(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
K = K & 0x7fff;
return op2_impl.create(OP_xor, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: (A ^ B) & K. Note: K is silently
* truncated to 15 bits.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint xor(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
K = K & 0x7fff;
int enc = op2_impl.encode(OP_xor, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: min(A,B) + K<p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint min(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
check_15_bit(K);
return op2_impl.create(OP_min, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: min(A,B) + K<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint min(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
int enc = op2_impl.encode(OP_min, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: max(A,B) + K<p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint max(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
check_15_bit(K);
return op2_impl.create(OP_max, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: max(A,B) + K<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint max(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
int enc = op2_impl.encode(OP_max, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (A + B)/2 + K<p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint ave(
std_objpart_encoding A,
std_objpart_encoding B,
int K)
{
check_15_bit(K);
return op2_impl.create(OP_ave, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: (A + B)/2 + K<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint ave(
ext_objpart_encoding A,
ext_objpart_encoding B,
int K)
{
int enc = op2_impl.encode(OP_ave, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: rotate_x(theta, D) + K where rotate_x
* computes the x position found by rotating the point dist,0 by theta/1000
* degrees counter-clockwise (i.e. a scaled sine function).<p>
*
* @param std_objpart_encoding theta obj/part designator for angle parameter
* @param std_objpart_encoding dist obj/part designator for distance parameter
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint rotx(
std_objpart_encoding theta, std_objpart_encoding dist, int K)
{
check_15_bit(K);
return op2_impl.create(OP_rotx, theta, dist, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: rotate_x(theta, D) + K where
* rotate_x computes the x position found by rotating the point dist,0 by
* theta/1000 degrees counter-clockwise (i.e. a scaled sine function).<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding theta obj/part designator for angle parameter
* @param ext_objpart_encoding dist obj/part designator for distance parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint rotx(
ext_objpart_encoding theta, ext_objpart_encoding dist, int K)
{
int enc = op2_impl.encode(OP_rotx, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, theta, dist, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: rotate_y(theta, D) + K where rotate_y
* computes the y position found by rotating the point dist,0 by theta/1000
* degrees counter-clockwise (i.e., a scaled cosine function).<p>
*
* @param std_objpart_encoding theta obj/part designator for angle parameter
* @param std_objpart_encoding dist obj/part designator for distance parameter
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint roty(
std_objpart_encoding theta, std_objpart_encoding dist, int K)
{
check_15_bit(K);
return op2_impl.create(OP_roty, theta, dist, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: rotate_y(theta, D) + K where
* rotate_y computes the y position found by rotating the point dist,0 by
* theta/1000 degrees counter-clockwise (i.e., a scaled cosine function).<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding theta obj/part designator for angle parameter
* @param ext_objpart_encoding dist obj/part designator for distance parameter
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint roty(
ext_objpart_encoding theta, ext_objpart_encoding dist, int K)
{
int enc = op2_impl.encode(OP_roty, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, theta, dist, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (if self.enabled then A else B) + K.
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint if_enabled(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_if_enabled, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function:
* (if self.enabled then A else B) + K.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K svalue for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint if_enabled(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_if_enabled, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: (if self.visible then A else B) + K.
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint if_visible(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_if_visible, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function:
* (if self.visible then A else B) + K.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint if_visible(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_if_visible, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: self.fun2(A,B,K) which is a special
* function in all interactors that can be overridden to to subclass specific
* things.
* <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint self_fun2(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_self_fun2, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: self.fun2(A,B,K) which is a
* special function in all interactors that can be overridden to to subclass
* specific things. <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint self_fun2(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_self_fun2, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function: parent.fun2(A,B,K) which is a special
* function in all interactors that can be overridden to to subclass specific
* things.
* <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint parent_fun2(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_parent_fun2, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function: parent.fun2(A,B,K) which is a
* special function in all interactors that can be overridden to to subclass
* specific things.<p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint parent_fun2(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_parent_fun2, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the constraint function for fill: B - A - K <p>
*
* @param std_objpart_encoding A object/part designator for parameter 1
* @param std_objpart_encoding B object/part designator for parameter 2
* @param int K 15 bit signed value for constant
* @return std_constraint constraint object for the result
*/
public static std_constraint fill(
std_objpart_encoding A, std_objpart_encoding B, int K)
{
check_15_bit(K);
return op2_impl.create(OP_fill, A, B, (short)K);
}
//had:
//* @exception bad_constraint if some part of the constraint is out of range or
//* malformed.
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create the external constraint function for fill: B - A - K <p>
*
* Note: the "self" object and orientation for this constraint need to
* be filled in before the constraint is used.<p>
*
* @param ext_objpart_encoding A object/part designator for parameter 1
* @param ext_objpart_encoding B object/part designator for parameter 2
* @param int K value for constant
* @return std_ext_constraint constraint object for the result
*/
public static std_ext_constraint fill(
ext_objpart_encoding A, ext_objpart_encoding B, int K)
{
int enc = op2_impl.encode(OP_fill, _dummy, _dummy, (short)0);
return new std_ext_constraint(enc, null, NOT_ORIENTED, A, B, K);
}
//had:
//* @exception bad_value if some part of the constraint is out of range or
//* malformed.
//* @exception general
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
/**
* Create an object reference to an arbitrary object. This can be "filled
* out" using the "part" methods of std_objpart_encoding (e.g., X(), etc.).
* @param interactor to_obj the object being referenced.
*/
public static ext_objpart_encoding OBJ(interactor to_obj)
{
return new ext_objpart_encoding(to_obj, 0);
}
/* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
}
/*=========================== COPYRIGHT NOTICE ===========================
This file is part of the subArctic user interface toolkit.
Copyright (c) 1996 Scott Hudson and Ian Smith
All rights reserved.
The subArctic system is freely available for most uses under the terms
and conditions described in
http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
and appearing in full in the lib/interactor.java source file.
The current release and additional information about this software can be
found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
========================================================================*/